]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Don't close submenus when the toplevel container is closed
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 12 Jun 2013 21:38:02 +0000 (17:38 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 15 Jul 2013 16:24:27 +0000 (12:24 -0400)
It seems this behavior at one time was intentional, but I (along with
the designers) think it looks ugly having the menu having its insides
shrinking and shifting around while fading out of existence.

There's two cases where we currently explicitly try to animate the
submenu closed -- when an item is clicked inside the submenu, and
when the toplevel closes. This removes both of those.

The user expectation is that submenus will be closed the next time the
toplevel is open even if they were open before, so force submenus closed
when the toplevel finishes fading out, without any animation.

https://bugzilla.gnome.org/show_bug.cgi?id=702539

js/ui/popupMenu.js

index b5b156db6ef34cc6563f65230b203a6fcc13786c..3b9347b3c534243e27b1f474095bbb83e168032f 100644 (file)
@@ -772,7 +772,6 @@ const PopupMenuBase = new Lang.Class({
     _connectSubMenuSignals: function(object, menu) {
         object._subMenuActivateId = menu.connect('activate', Lang.bind(this, function() {
             this.emit('activate');
-            this.close(BoxPointer.PopupAnimation.FULL);
         }));
         object._subMenuActiveChangeId = menu.connect('active-changed', Lang.bind(this, function(submenu, submenuItem) {
             if (this._activeMenuItem && this._activeMenuItem != submenuItem)
@@ -887,10 +886,14 @@ const PopupMenuBase = new Lang.Class({
                     else
                         menuItem.close();
                 });
+            menuItem._parentClosingId = this.connect('menu-closed', function() {
+                menuItem.emit('menu-closed');
+            });
             menuItem.connect('destroy', Lang.bind(this, function() {
                 menuItem.disconnect(menuItem._subMenuActivateId);
                 menuItem.disconnect(menuItem._subMenuActiveChangeId);
                 this.disconnect(menuItem._parentOpenStateChangedId);
+                this.disconnect(menuItem._parentClosingId);
 
                 this.length--;
             }));
@@ -901,9 +904,8 @@ const PopupMenuBase = new Lang.Class({
                 this.box.insert_child_below(menuItem.menu.actor, before_item);
             this._connectSubMenuSignals(menuItem, menuItem.menu);
             this._connectItemSignals(menuItem);
-            menuItem._closingId = this.connect('open-state-changed', function(self, open) {
-                if (!open)
-                    menuItem.menu.close(BoxPointer.PopupAnimation.FADE);
+            menuItem._closingId = this.connect('menu-closed', function() {
+                menuItem.menu.close(BoxPointer.PopupAnimation.NONE);
             });
         } else if (menuItem instanceof PopupSeparatorMenuItem) {
             this._connectItemSignals(menuItem);
@@ -1114,8 +1116,11 @@ const PopupMenu = new Lang.Class({
             childMenu.close();
         });
 
-        if (this._boxPointer.actor.visible)
-            this._boxPointer.hide(animate);
+        if (this._boxPointer.actor.visible) {
+            this._boxPointer.hide(animate, Lang.bind(this, function() {
+                this.emit('menu-closed');
+            }));
+        }
 
         if (!this.isOpen)
             return;